package day10HomeWork;
import java.util.Random;
import java.util.Scanner;
public class Test {
    public static void main(String[] args) {
        String line = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        Random random = new Random();
        String code = "";
        for (int i = 0; i <4 ; i++) {
            int index = random.nextInt(line.length());
            char c = line.charAt(index);
            code+=c;
        }
        System.out.println("验证码："+code);
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入上述验证码");
        String input = scanner.nextLine();

        if (code.equalsIgnoreCase(input)){
            System.out.println("通过");
        }else{
            System.out.println("失败");
        }



    }
}
